package com.neusoft.bizcore.notice.notification.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "neuiot_notice_template_attachment")
@org.hibernate.annotations.Table(appliesTo = "neuiot_notice_template_attachment", comment = "通知模板附件表")
public class NoticeTemplateAttachment extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "文件名称不能为空")
    @Length(max = 255, message = "文件名称不能超过{max}位")
    @Column(length = 255, nullable = false)
    private String name;

    @Lob
    @Column(columnDefinition = "longtext")
    @Comment("longtext COMMENT '模板'")
    private byte[] template;

    @OneToOne(targetEntity = NoticeTemplate.class)
    private NoticeTemplate noticeTemplate;

}
